#include <iostream>
#include <vector>
#include <queue>

using namespace std;

class Solution
{
public:
    string minimizeStringValue(string s)
    {
        int changeable = 0;
        vector<int> v(26, 0);
        for (char c : s)
        {
            if (c != '?')
                v[c - 'a']++;
            else
                changeable++;
        }
        priority_queue<pair<int, char>, vector<pair<int, char>>, greater<pair<int, char>>> pq;
        for (int i = 0; i < 26; i++)
            pq.push({v[i], i + 'a'});

        vector<int> addtive(26, 0);
        for (int i = 0; i < changeable; i++)
        {
            auto [v, c] = pq.top();
            pq.pop();
            addtive[c - 'a']++;
            pq.push({v + 1, c});
        }

        for (char &c : s)
        {
            if (c == '?')
            {
                for (int i = 0; i < 26; i++)
                {
                    if (addtive[i] > 0)
                    {
                        c = i + 'a';
                        addtive[i]--;
                        break;
                    }
                }
            }
        }
        return s;
    }
};

int main()
{
    cout << "Code3081" << endl;
    Solution s;
    cout << s.minimizeStringValue("?htxzbzkngkgna?zrzc??fkcep?") << endl;
    return 0;
}